<!DOCTYPE html>
<html>
<head>
<title>Daftar Berita</title>
<link href="View/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="View/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link  href="View/bootstrap/js/bootstrap.min.js" rel="stylesheet"/>
<script type="text/javascript" src="View/bootstrap/js/jquery-latest.js"></script>
</head>
<?php
include_once '../model/news.php';
session_start();
if (!isset($_SESSION["id_user"])){
	include '/content/content_header_guest.php';
} else {
	include '/content/content_header_user.php';
}
?>
<body> 
<h3>Daftar Berita </h3>  
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span9">
			<a href="form_berita.php" class="pull-right" >+Tambah</a>
				<table class="table table-hover">
					<th>Judul</th>
					<th>Isi</th>
					<th>&nbsp;</th>
					<?php 
					$insertnews = new ModelNews();
					if (isset($_GET['delete'])) {
						$insertnews -> deleteNews($_GET['delete']);
					}
					$news = $insertnews-> getNews();	
					if (!empty($news))
					{
						foreach ($news as $id_berita => $news)
						{
							echo 
							'<tr>
								<td>'.$news->judulberita.'</td>									
								<td>'.$news->isiberita.'</td>
								<td><a href="list_berita.php?delete='.$news->id_berita.'">Hapus</a> | <a href="form_edit_berita.php?edit='.$news->id_berita.'">Edit</i></a></td>
							</tr>';
						}
					} else {
							echo 
								'<tr>
									<td>tidak ada berita</td>
								</tr>';
						}
					?>
				</table>
			</div>
			<div class="span3">
				<?php 
					include '/content/content_mini_list_produk.php';
				?>
				<?php
					include '/content/content_banner.php';
				?>
			</div>
		</div>
    </div>
</body>
<?php
include '/content/content_footer_site_map.php';
include '/content/content_footer.php';
?>